package com.system.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.system.tool.my.annotation.Authority;
import com.system.tool.my.annotation.AuthorityType;

@Controller
public class TestContoller {

	@ResponseBody
	// 将内容或对象作为 HTTP 响应正文返回，
	// 使用@ResponseBody将会跳过视图处理部分，而是调用适合HttpMessageConverter，将返回值写入输出流。
	@RequestMapping("/home/test")
	public Map<String, Object> test() {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("data", "test msg");
		return map;
	}
	
	@Authority(AuthorityType.Validate)
	@ResponseBody
	@RequestMapping("/home/show/stuednet")
	public Map<String, Object> showStudents() {
		Map<String, Object> map = new HashMap<String, Object>();
		Student s = new Student();
		List list = new ArrayList();
		s.setName("mike");
		s.setRollNo("233");
		s.setPercentage("heloll");
		list.add(s);
		s.setName("joe");
		list.add(s);
		map.put("data", list);
		return map;
	}

}
